class PublicController < ApplicationController

  def showpage
    @page = Page.find(:first, :conditions => ['pageNameUrl = ? AND categoryNameUrl = ?', params[:page], params[:category] ])
    
    @categories = Category.find(:all)
    @pageref = PageRef.find(:all, :conditions => ['categoryNameUrl = ?', params[:category] ])
    
    @sideboxes = Sidebox.find(:all)
    
    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @pages }
    end
  end
  
  def contact
    @email = Emailer.new
    
    @page = Page.new
    @page.title = "Contact us..."
    @categories = Category.find(:all)
    @pageref = PageRef.find(:all, :conditions => ['categoryNameUrl = ?', params[:category] ])
    
    @sideboxes = Sidebox.find(:all)
    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @pages }
    end
  end
  
  def send_mail
    Emailer::deliver_contact_email(params[:email])
  end
 

end
